from django import forms 
from models import *

"""class PostAddForm(forms.Form):
    ad_type = forms.ChoiceField(choices=[('sell', 'sell'), ('buy', 'buy')])
    ad_title = forms.CharField(max_length=100)
    ad_description = forms.CharField(widget=forms.Textarea)
    ad_posted_by = forms.CharField(max_length=100)
    ad_quoted_price = forms.CharField(max_length=100)
    ad_email = forms.CharField(max_length=100)
    ad_condition = forms.CharField(max_length=10)
    ad_location = forms.CharField(max_length=100)
"""
class PostAddForm(forms.ModelForm):
    class Meta:
      model = PostAdd 
      exclude = ['ad_status']
class UserRegisterForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(UserRegisterForm, self).__init__(*args, **kwargs)
        #self.fields['user'] = forms.CharField(max_length=100)
        self.locs = gLocation.objects.all()
        self.fields['location'] = forms.ChoiceField(choices=[(x.id, x.loc_name) for x in self.locs] or [], widget=forms.Select())
        #self.fields['location'] = forms.TypedChoiceField(choices=[('hyd','HYD'), ('bang', 'Bangalore')] or [], widget=forms.Select(), empty_value='')
        #self.fields['location'] = forms.ModelChoiceField(queryset=gLocation.objects.values('loc_name'), empty_label='----')
        #self.fields['first_name'] = forms.CharField(max_length=100)
        #self.fields['last_name'] = forms.CharField(max_length=100)
        #self.fields['gender'] = forms.CharField(max_length=100) 
    class Meta:
        model = gadd_users

class PostCommentForm(forms.ModelForm):
  class Meta:
    model = PostComment
    exclude = ['comment_status']
